<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>用户注册 - 通行证 </title>


    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <LINK rel="Bookmark" href="/favicon.ico" >
    <LINK rel="Shortcut Icon" href="/favicon.ico" />

    <link rel="stylesheet" type="text/css" href="/forum/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/forum/css/passnumberbind.css"/>
    <link rel="stylesheet" href="/forum/css/mystyle.css">
    <link th:if="${@config.getKey('forum.theme.color')=='red'}" rel="stylesheet" href="/forum/css/hellorf.css">
</head>
<body>
<div id="body">
    <div class="passcard-box">

        <div class="passcard-nav">
            <a>ruoyi-plus论坛通行证</a>
            <a href="/forum" class="login-right-subnav main-link-color">返回首页</a>

            <span class="login-right-subnav login-nav">已有帐号，

                    <a href="/login" class="main-link-color">马上登录</a>

              </span>
        </div>

        <!-- 登录导航以下内容 -->
        <div class="passcon">
            <h2 class="passmail-title main-bg-color">注册会员</h2>
            <form  id="register_form" autocomplete="off">
                <input type="hidden" name="appId" value="1006"/>
                <input type="hidden" name="third" value=""/>
                <input type="hidden" name="invite_user_id" value=""/>


                <div class="retrieve-pass-box " style="padding-bottom: 60px;">
                    <div class="retrie-center" id="inputparent">
                        <div class="parent-input-box">
                            <!-- <i class="tel"></i> -->
                            <div class="country-phone-covers">
                                <input type="text" name="p-phone" id="mobilephone"  placeholder="邮箱"
                                       class="text-style ipt-area-current  ipt-w-334">
                            </div>
                            <span class="form-tip"></span>
                        </div>

                        <div class="parent-input-box js-h-from-ele" style="display: block">
                            <!-- <i class="codeeye"></i> -->
                            <input type="text" name="phoneCode" autocomplete="off" id="vericode" placeholder="验证码"
                                   class="text-style verification-code vericode">
                            <!-- btn-default-main -->
                            <input type="button"  value="发送验证码" name="" id="veribtn" class="btn-default-main codebtn">
                            <span class="no-ver-code js-no-ver-code">未收到验证码?</span>
                            <span class="form-tip"></span>
                        </div>
                        <div class="parent-input-box js-h-from-ele" style="display: block">

                            <!--<input type="password" name="password1" style="visibility:hidden;height:0px;border:none;float:left;">-->
                            <input type="password" autocomplete="off" name="password" id="password" placeholder="密码"
                                   class="text-style input-normal-style vericode"><i class="form-eye-icon"></i>
                            <span class="form-tip">

                            </span>
                        </div>
                        <div class="agreemen-txt checkbox-wrap">
                            <label class="label-checkbox check-c" for="Useragreement">
                                <input type="checkbox" name="Useragreement" id="Useragreement" class="check-c">我已阅读并接受
                                <a href="/userAgreement" target="_blank" class="main-link-color">用户协议</a>
                                和
                                <a href="/policy" target="_blank" class="main-link-color">隐私政策</a>
                            </label>
                            <span class="form-tip"></span>
                        </div>
                        <div class="passcard-btns register-btn">
                            <input type="button" value="注册"  id="z-p-registered" class="btn-default-main passcard-btn">
                        </div>
                        <!--<div class="third-party-covers">
                            <span class="p-666">使用社交帐号注册</span>
                            <div class="pass-account-covers">
                                <a href="/login/third?t=wx" class="p-wechat-login"></a>
                                <a  class="p-weibo-login"></a>
                                <a href="/login/third?t=qq" class="p-qq-login"></a>
                            </div>
                        </div>-->
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="footer">
        <p>冀ICP备20019204号</p>
        <p>Copyright © http://ry.aileig.com/forum All Rights Reserved. </p>
    </div>

    <script type="text/javascript" src="/forum/lib/jquery.min.js"></script>
    <script  th:src="@{/ajax/libs/layer/layer.min.js}"></script>
    <script  th:src="@{/ruoyi/js/ry-ui.js}"></script>
    <script th:inline="javascript"> var ctx = [[@{/}]];</script>

</div>
<div id="_umfp" style="display:inline;width:1px;height:1px;overflow:hidden"></div>

<script>
    $().ready(function(){
        $("#password").next().click(function(){
            if($("#password").next().hasClass("disabled-glance")){
                $("#password").next().removeClass("disabled-glance");
                $("#password").attr("type","password");
            }else{
                $("#password").next().addClass("disabled-glance");

                $("#password").attr("type","text");
            }
        });
        //我已经阅读协议
        $("#Useragreement").click(function(){
            var b=$(this).prop("checked");

            if(b){
                $(this).attr("checked","checked");
                $(this).parent().removeClass("check-cd").removeClass("check-c").addClass("check-cd");
            }else{
                $(this).removeAttr("checked");
                $(this).parent().removeClass("check-cd").removeClass("check-c").addClass("check-c");
            }
        });

        //发送验证码
        $("#veribtn").click(function () {
           /* var phone=$("#mobilephone").val();
            if($.common.isEmpty(phone)){
                $.modal.msgError("请输入手机号!");
                return;
            }
            if(!isTelePhone(phone)){
                $.modal.msgError("手机号格式不正确!");
                return;
            }
            var okFlag=true;
            //检测手机是否注册
            $.ajax({
                async: false,
                type: "post",
                url: ctx + "checkPhone",//检测手机是否注册
                xhrFields: {
                    withCredentials: true
                },
                data: {
                    "phone": phone
                },
                success: function(r) {
                    if (r.code == 0) {
                        //已经注册
                        okFlag=false;
                    }
                }
            });
            if(!okFlag){
                $.modal.msgError("手机号已经注册!");
                return
            }*/
            var email=$("#mobilephone").val();
            if($.common.isEmpty(email)){
                $.modal.msgError("请输入邮箱!");
                return;
            }
            if(!isEmail(email)){
                $.modal.msgError("邮箱格式不正确!");
                return;
            }
            $.ajax({
                type: "post",
                url: ctx + "register/sendEmail",//用户注册发送手机验证码
                xhrFields: {
                    withCredentials: true
                },
                data: {
                    "email": email
                },
                beforeSend:function(){
                    smsWaitTime($('#veribtn'), 60);
                },
                success: function(r) {

                    if (r.code == 0) {
                        $.modal.msgSuccess(r.msg);
                    } else {
                        $.modal.msgError(r.msg);
                    }
                }
            });

        });
        //提交注册
        $("#z-p-registered").click(function(){
            var email=$("#mobilephone").val();
            if($.common.isEmpty(email)){
                $.modal.msgError("请输入邮箱!");
                return;
            }
            if(!isEmail(email)){
                $.modal.msgError("邮箱格式不正确!");
                return;
            }
            var code=$("#vericode").val();
            if($.common.isEmpty(code)){
                $.modal.msgError("请输入验证码!");
                return;
            }
            var pwd=$("#password").val();
            if($.common.isEmpty(pwd)){
                $.modal.msgError("请输入密码!");
                return;
            }
            var readFlag = $("input[name='Useragreement']").is(':checked');
            if(!readFlag){
                $.modal.msgError("请勾选已经阅读协议!");return;
            }
            $.ajax({
                type: "post",
                url: ctx + "register",//提交注册
                xhrFields: {
                    withCredentials: true
                },
                data: {
                    "email": email,
                    "code": code,
                    "password": pwd
                },
                success: function(r) {

                    if (r.code == 0) {
                        $.modal.msgSuccess(r.msg);
                        $("#register_form")[0].reset();
                    } else {
                        $.modal.msgError(r.msg);
                    }
                }
            });

        });

    });
    // 验证码倒计时；
    var wait = 60;
    function smsWaitTime(o, waitP) {
        if (wait == 0) {
            $(o).removeAttr('disabled');
            $(o).removeClass("btn-disabled").addClass('btn-default-main').removeAttr('disabled');
            $(o).val("发送验证码");
            wait = waitP;
            $(o).attr('time', '1')
            //$('.js-no-ver-code').show();
        } else {
            $(o).prop('disabled', true);
            $(o).addClass("btn-disabled").removeClass('btn-default-main').attr('disabled',true);
            $(o).attr('disabled', 'disabled');
            $(o).val(wait + 's' + "后重新发送");
            $(o).attr('time', '0')
            wait--;
            setTimeout(function () { smsWaitTime(o, waitP) }, 1000);
        }
    }

    //手机号
    function isTelePhone(v){
        var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
        if (!myreg.test(v)) {
            return false;
        } else {
            return true;
        }
    }

    function isEmail(v) {
        var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if (!myreg.test(v))//对输入的值进行判断
        {
            return false;
        }
        return true;
    }
    function isQQ(v){
        if(/^[0-9]{5,10}$/.test(v)){
            return true;
        }else{
            return false;
        }
    }

</script>
</body>
</html>